/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


/*
 * Función para la eliminación de registros. 
 */

function eliminarRegistro(strCodigo, strAccion){
    
    if (confirm('¿Está seguro que desea eliminar el registro seleccionado?')){
        if (strAccion == "rolesXpersona"){        
            AJAXC("POST","Visualizacion","txtAccion=rolesXpersona&txtEvento=Eliminar&txtCodigo=" + strCodigo,"dMostrar");
        }

        if (strAccion == "equiposXComp"){        
            AJAXC("POST","Visualizacion","txtAccion=equiposXComp&txtEvento=Eliminar&txtCodigo=" + strCodigo,"dMostrar");
        }

        if (strAccion == "comp_plataforma"){        
            AJAXC("POST","Visualizacion","txtAccion=comp_plataforma&txtEvento=Eliminar&txtCodigo=" + strCodigo,"dMostrar");            
        }

        if (strAccion == "usuarios"){        
            AJAXC("POST","Visualizacion","txtAccion=usuarios&txtEvento=Eliminar&txtCodigo=" + strCodigo,"dMostrar");
        }

        if (strAccion == "personas"){        
            AJAXC("POST","Visualizacion","txtAccion=personas&txtEvento=Eliminar&txtCodigo=" + strCodigo,"dMostrar");
        }

        if (strAccion == "estados_sol"){        
            AJAXC("POST","Visualizacion","txtAccion=estados_sol&txtEvento=Eliminar&txtCodigo=" + strCodigo,"dMostrar");
        }

        if (strAccion == "servicios"){        
            AJAXC("POST","Visualizacion","txtAccion=servicios&txtEvento=Eliminar&txtCodigo=" + strCodigo,"dMostrar");
        }

        if (strAccion == "etapas"){        
            AJAXC("POST","Visualizacion","txtAccion=etapas&txtEvento=Eliminar&txtCodigo=" + strCodigo,"dMostrar");
        }
        
        if (strAccion == "campos"){        
            AJAXC("POST","Visualizacion","txtAccion=campos&txtEvento=Eliminar&txtCodigo=" + strCodigo,"dMostrar");
        }
        
        if (strAccion == "camposXetapa"){        
            AJAXC("POST","Visualizacion","txtAccion=camposXetapa&txtEvento=Eliminar&txtCodigo=" + strCodigo,"dMostrar");
        }

        if (strAccion == "tipos_persona"){        
            AJAXC("POST","Visualizacion","txtAccion=tipos_persona&txtEvento=Eliminar&txtCodigo=" + strCodigo,"dMostrar");
        }

        if (strAccion == "roles"){        
            AJAXC("POST","Visualizacion","txtAccion=roles&txtEvento=Eliminar&txtCodigo=" + strCodigo,"dMostrar");
        }

        if (strAccion == "equipos"){        
            AJAXC("POST","Visualizacion","txtAccion=equipos&txtEvento=Eliminar&txtCodigo=" + strCodigo,"dMostrar");
        }
        
        if (strAccion == "faqs"){        
            AJAXC("POST","Visualizacion","txtAccion=faqs&txtEvento=Eliminar&txtCodigo=" + strCodigo,"dMostrar");
        }
    }
}

/*
 * Función para la creación de registros. 
 */

function crearRegistro(strAccion){
    
    if (strAccion == "rolesXpersona"){        
        window.open("rolXpersona.jsp?txtAccion=C","Equipo_X_Componente",'top=0,left=0,width='+(screen.availWidth)+',height ='+(screen.availHeight)+',toolbar=0 ,location=0,directories=0,status=0,menubar=0,resizable=1,scrolling=1,scrollbars=yes');
    }
    
    if (strAccion == "equiposXComp"){        
        window.open("equipoXcomp.jsp?txtAccion=C","Equipo_X_Componente",'top=0,left=0,width='+(screen.availWidth)+',height ='+(screen.availHeight)+',toolbar=0 ,location=0,directories=0,status=0,menubar=0,resizable=1,scrolling=1,scrollbars=yes');
    }
        
    if (strAccion == "comp_plataforma"){        
        window.open("comp_plataforma.jsp?txtAccion=C","Componente",'top=0,left=0,width='+(screen.availWidth)+',height ='+(screen.availHeight)+',toolbar=0 ,location=0,directories=0,status=0,menubar=0,resizable=1,scrolling=1,scrollbars=yes');
    }
    
    if (strAccion == "usuarios"){        
        window.open("usuario.jsp?txtAccion=C","Usuario",'top=0,left=0,width='+(screen.availWidth)+',height ='+(screen.availHeight)+',toolbar=0 ,location=0,directories=0,status=0,menubar=0,resizable=1,scrolling=1,scrollbars=yes');
    }
    
    if (strAccion == "personas"){        
        window.open("persona.jsp?txtAccion=C&txtSource=U","Persona",'top=0,left=0,width='+(screen.availWidth)+',height ='+(screen.availHeight)+',toolbar=0 ,location=0,directories=0,status=0,menubar=0,resizable=1,scrolling=1,scrollbars=yes');
    }
    
    if (strAccion == "estados_sol"){        
         window.open("estado_sol.jsp?txtAccion=C","Estado_Sol",'top=0,left=0,width='+(screen.availWidth)+',height ='+(screen.availHeight)+',toolbar=0 ,location=0,directories=0,status=0,menubar=0,resizable=1,scrolling=1,scrollbars=yes');
    }
    
    if (strAccion == "servicios"){        
        window.open("servicio.jsp?txtAccion=C","Servicio",'top=0,left=0,width='+(screen.availWidth)+',height ='+(screen.availHeight)+',toolbar=0 ,location=0,directories=0,status=0,menubar=0,resizable=1,scrolling=1,scrollbars=yes');
    }
    
    if (strAccion == "etapas"){        
        window.open("etapa.jsp?txtAccion=C","Etapa",'top=0,left=0,width='+(screen.availWidth)+',height ='+(screen.availHeight)+',toolbar=0 ,location=0,directories=0,status=0,menubar=0,resizable=1,scrolling=1,scrollbars=yes');
    }
    
    if (strAccion == "campos"){        
        window.open("campo.jsp?txtAccion=C","Campo",'top=0,left=0,width='+(screen.availWidth)+',height ='+(screen.availHeight)+',toolbar=0 ,location=0,directories=0,status=0,menubar=0,resizable=1,scrolling=1,scrollbars=yes');
    }
    
    if (strAccion == "camposXetapa"){        
        window.open("campoXetapa.jsp?txtAccion=C","Campo_X_Etapa",'top=0,left=0,width='+(screen.availWidth)+',height ='+(screen.availHeight)+',toolbar=0 ,location=0,directories=0,status=0,menubar=0,resizable=1,scrolling=1,scrollbars=yes');
    }
    
    if (strAccion == "tipos_persona"){        
        window.open("tipo_persona.jsp?txtAccion=C","Tipo_Persona",'top=0,left=0,width='+(screen.availWidth)+',height ='+(screen.availHeight)+',toolbar=0 ,location=0,directories=0,status=0,menubar=0,resizable=1,scrolling=1,scrollbars=yes');
    }
    
    if (strAccion == "roles"){        
        window.open("rol.jsp?txtAccion=C","Rol",'top=0,left=0,width='+(screen.availWidth)+',height ='+(screen.availHeight)+',toolbar=0 ,location=0,directories=0,status=0,menubar=0,resizable=1,scrolling=1,scrollbars=yes');
    }
    
    if (strAccion == "equipos"){        
        window.open("equipo.jsp?txtAccion=C","Equipo",'top=0,left=0,width='+(screen.availWidth)+',height ='+(screen.availHeight)+',toolbar=0 ,location=0,directories=0,status=0,menubar=0,resizable=1,scrolling=1,scrollbars=yes');
    }
    
    if (strAccion == "faqs"){        
        window.open("pregunta_frecuente.jsp?txtAccion=C","Pregunta_Frecuente",'top=0,left=0,width='+(screen.availWidth)+',height ='+(screen.availHeight)+',toolbar=0 ,location=0,directories=0,status=0,menubar=0,resizable=1,scrolling=1,scrollbars=yes');
    }
    
}

/*
 * Funciones para la apertura de registros. 
 */

function abrirRegSolicitud(strCodigo){
    window.open("solicitud.jsp?txtAccion=V&txtCodigo=" + strCodigo,"Solicitud",'top=0,left=0,width='+(screen.availWidth)+',height ='+(screen.availHeight)+',toolbar=0 ,location=0,directories=0,status=0,menubar=0,resizable=1,scrolling=1,scrollbars=yes');
}

function abrirRegEquipo(strCodigo){
    window.open("equipo.jsp?txtAccion=V&txtCodigo=" + strCodigo,"Equipo",'top=0,left=0,width='+(screen.availWidth)+',height ='+(screen.availHeight)+',toolbar=0 ,location=0,directories=0,status=0,menubar=0,resizable=1,scrolling=1,scrollbars=yes');
}

function abrirRegRol(strCodigo){
    window.open("rol.jsp?txtAccion=V&txtCodigo=" + strCodigo,"Rol",'top=0,left=0,width='+(screen.availWidth)+',height ='+(screen.availHeight)+',toolbar=0 ,location=0,directories=0,status=0,menubar=0,resizable=1,scrolling=1,scrollbars=yes');
}

function abrirTipoPersona(strCodigo){
    window.open("tipo_persona.jsp?txtAccion=V&txtCodigo=" + strCodigo,"Tipo_Persona",'top=0,left=0,width='+(screen.availWidth)+',height ='+(screen.availHeight)+',toolbar=0 ,location=0,directories=0,status=0,menubar=0,resizable=1,scrolling=1,scrollbars=yes');
}

function abrirRegEtapa(strCodigo){
    window.open("etapa.jsp?txtAccion=V&txtCodigo=" + strCodigo,"Etapa",'top=0,left=0,width='+(screen.availWidth)+',height ='+(screen.availHeight)+',toolbar=0 ,location=0,directories=0,status=0,menubar=0,resizable=1,scrolling=1,scrollbars=yes');
}

function abrirRegCampo(strCodigo){
    window.open("campo.jsp?txtAccion=V&txtCodigo=" + strCodigo,"Etapa",'top=0,left=0,width='+(screen.availWidth)+',height ='+(screen.availHeight)+',toolbar=0 ,location=0,directories=0,status=0,menubar=0,resizable=1,scrolling=1,scrollbars=yes');
}

function abrirRegCampoXEtapa(strCodigo){
    window.open("campoXetapa.jsp?txtAccion=V&txtCodigo=" + strCodigo,"Equipo_X_Componente",'top=0,left=0,width='+(screen.availWidth)+',height ='+(screen.availHeight)+',toolbar=0 ,location=0,directories=0,status=0,menubar=0,resizable=1,scrolling=1,scrollbars=yes');
}

function abrirRegServicio(strCodigo){
    window.open("servicio.jsp?txtAccion=V&txtCodigo=" + strCodigo,"Servicio",'top=0,left=0,width='+(screen.availWidth)+',height ='+(screen.availHeight)+',toolbar=0 ,location=0,directories=0,status=0,menubar=0,resizable=1,scrolling=1,scrollbars=yes');
}

function abrirRegEstadoSol(strCodigo){
    window.open("estado_sol.jsp?txtAccion=V&txtCodigo=" + strCodigo,"Estado_Sol",'top=0,left=0,width='+(screen.availWidth)+',height ='+(screen.availHeight)+',toolbar=0 ,location=0,directories=0,status=0,menubar=0,resizable=1,scrolling=1,scrollbars=yes');
}

function abrirRegPersona(strCodigo){
    window.open("persona.jsp?txtAccion=V&txtCodigo=" + strCodigo,"Persona",'top=0,left=0,width='+(screen.availWidth)+',height ='+(screen.availHeight)+',toolbar=0 ,location=0,directories=0,status=0,menubar=0,resizable=1,scrolling=1,scrollbars=yes');
}

function abrirRegUsuario(strCodigo){
    window.open("usuario.jsp?txtAccion=V&txtCodigo=" + strCodigo,"Usuario",'top=0,left=0,width='+(screen.availWidth)+',height ='+(screen.availHeight)+',toolbar=0 ,location=0,directories=0,status=0,menubar=0,resizable=1,scrolling=1,scrollbars=yes');
}

function abrirRegComp_Plataforma(strCodigo){
    window.open("comp_plataforma.jsp?txtAccion=V&txtCodigo=" + strCodigo,"Componente",'top=0,left=0,width='+(screen.availWidth)+',height ='+(screen.availHeight)+',toolbar=0 ,location=0,directories=0,status=0,menubar=0,resizable=1,scrolling=1,scrollbars=yes');
}

function abrirRegEquipoXComp(strCodigo){
    window.open("equipoXcomp.jsp?txtAccion=V&txtCodigo=" + strCodigo,"Equipo_X_Componente",'top=0,left=0,width='+(screen.availWidth)+',height ='+(screen.availHeight)+',toolbar=0 ,location=0,directories=0,status=0,menubar=0,resizable=1,scrolling=1,scrollbars=yes');
}

function abrirRegRolXpersona(strCodigo){
    window.open("rolXpersona.jsp?txtAccion=V&txtCodigo=" + strCodigo,"Rol_X_Persona",'top=0,left=0,width='+(screen.availWidth)+',height ='+(screen.availHeight)+',toolbar=0 ,location=0,directories=0,status=0,menubar=0,resizable=1,scrolling=1,scrollbars=yes');
}

function abrirRegFAQ(strCodigo){
    window.open("pregunta_frecuente.jsp?txtAccion=V&txtCodigo=" + strCodigo,"Pregunta_Frecuente",'top=0,left=0,width='+(screen.availWidth)+',height ='+(screen.availHeight)+',toolbar=0 ,location=0,directories=0,status=0,menubar=0,resizable=1,scrolling=1,scrollbars=yes');
}

function buscarRegistro(strAccion){
    form = document.frmBusqueda;  

    var strMsg = "";
    var strHead = "Antes de continuar debe diligenciar los siguientes campos:\n\n";
	
    strMsg += validarCampoSelect(form.txtCriterio,"Criterio");
    strMsg += validarCampoVacio(form.txtClave,"Palabra clave");
    
    if (strMsg != ""){
        strMsg = strHead + strMsg;
        alert(strMsg);

        strCriterio = form.txtCriterio;
        strClave = form.txtClave.value;                

        if ((strCriterio.selectedIndex == 0) && (strClave == "")){
                form.txtCriterio.focus();
        }else{
                if (strCriterio.selectedIndex == 0){
                        form.txtCriterio.focus();
                }else{
                        form.txtClave.focus();
                }
        }

        return false;
      }
          
      AJAXC("POST","Visualizacion","txtAccion=" + strAccion + "&txtEvento=busqueda&txtCriterio=" + form.txtCriterio.value + "&txtClave=" + form.txtClave.value,"dMostrar");   
}


